format debug "--  Compiling ChangeSpriteAction Class . . .\n" undefined undefined


class ChangeSpriteAction (Action)

	instance variables
		target
		location
		inks
end

method init self {class ChangeSpriteAction} #rest args #key target:(undefined) location: inks:->
(	
	apply nextMethod self args
	
	self.target := target
	self.location := location
	self.inks := inks
	
)

method trigger self {class ChangeSpriteAction} theTarget thePlayer ->
(	
	-- self.target should be a presenter
	-- Copy over all the interesting aspects
	
	local newTarget := self.target
	
	theTarget.boundary := newTarget.boundary
--	if isAKindOf theTarget TextSprite do
--	(
--		theTarget.boundary := newTarget.boundary
--	)
	
	-- Assign other IVs
	theTarget.fill := newTarget.fill
	theTarget.stroke := newTarget.stroke

	local obj := self.inks[@matte]
	local sten := theTarget.boundary
	if (sten.matteColor <> obj) do
	(
		sten.matteColor :=  obj
	)

	obj := self.inks[@invisible]
	if (sten.invisibleColor <> obj) do
	(
		sten.invisibleColor := obj
	)
	
	theTarget.position := self.location
)

#(ChangeSpriteAction,#(),#())
